package com.fanrenqiji.common.persistence;

import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author lijian E-mail:ljz0721cx@163.com
 * @version 创建时间：2015年3月5日 上午11:24:09
 * @description
 */
@MappedSuperclass
public class DateEntity extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;
	/**
	 * 
	 */
	private Long id;
	/**
	 * 创建日期
	 */
	protected Date createDate;
	/**
	 * 状态标记：删除标记（0：正常；1：删除；2：审核）
	 */
	protected String delFlag;
	
	public DateEntity() {
		super();
		//初始化时候默认是正常的
		this.delFlag = DEL_FLAG_NORMAL;
	}
	@PrePersist
	public void prePersist() {
		this.createDate=new Date();
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="create_date")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Length(min=1, max=1)
	@Column(name="del_flag")
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}
	
	
}
